// 住院发药查询
import React from 'react';
import { Card, Row, Col, Form, DatePicker, Select, Button, Icon, Table, Switch, message, Pagination  } from 'antd';
import ColumnAuthoritysModel from 'pages/columnAuthority/ColumnAuthoritysModel';
import CommonPagination from 'components/pagination/index';
import { $http } from 'containers/config/https';
import Moment from 'moment';
import store from 'store';
import '../../hospitalPharmacies/style/index.less';
var serialNumber = 0; //住院发药查询序列号

const { Option } = Select;
const FormItem = Form.Item;
const formItemLayout = {    // label 和input宽度
    labelCol: { span:7 },
    wrapperCol: { span: 17 },
};

const HPDrugInquiry = Form.create()(
    class extends React.Component {
        constructor() {
            super();
            this.state = {
                userInfo: JSON.parse(window.sessionStorage.userData),
                data: [],
                queryCondition: {},
                SelectData: {},
                inOpLocDr:'',
                vendor: '',
                detailsId: '',//住院发药查询ID
                HPDrugInquiryDetailData:[], //住院发药查询明细数据
                HPDrugInquiryData: [], //住院发药查询数据
                HPDrugInquiryCollectData: [], // 住院发药查询汇总数据
                pageSize: 10,
                page: 1,
                pageSize2: 10,
                page2: 1,
                pageSizeCollect: 10,
                pageCollect: 1,
                total:0,
                detailTotal: 0,
                collectTotal: 0,
                noData: false,
                detailWidthTotal: '',
                columns: [],
                modalColumns:[],
                modalColumnsCollect:[], // 汇总表头数据
                modificationList: false,  //默认隐藏修改表头弹窗
                showDetailPopup: false,  //默认隐藏修改表头弹窗
                listLength: '',  //列表长度
                listLengthCollect: '',  //汇总列表长度
                parameterCode: '',
                HPDrugID: '', //主列表行id
                show: false

            }
            // 住院发药查询的数据表头
            this.columns = [
                {
                    key: 1,
                    title: '发药单号',
                    dataIndex: 'dispNO',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 2,
                    title: '病区',
                    dataIndex: 'wardDesc',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 3,
                    title: '发药类别',
                    dataIndex: 'dispCatDesc',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 4,
                    title: '打印日期',
                    dataIndex: 'printDate',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 5,
                    title: '打印时间',
                    dataIndex: 'printTime',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 6,
                    title: '发药日期',
                    dataIndex: 'dispDate',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 7,
                    title: '发药时间',
                    dataIndex: 'dispTime',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 8,
                    title: '发药人',
                    dataIndex: 'dispUserName',
                    align: "center",
                    width: '150px'
                }
            ];
            // 住院发药查询汇总表头
            this.collectModalColumns = [
                {
                    key: 1,
                    title: '药品代码',
                    dataIndex: 'stockCode',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 2,
                    title: '药品名称',
                    dataIndex: 'stockDesc',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 3,
                    title: '发药数量',
                    dataIndex: 'dispQty',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 4,
                    title: '发药单位',
                    dataIndex: 'unitDesc',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 5,
                    title: '发药金额',
                    dataIndex: 'sumAmt',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 6,
                    title: '药品规格',
                    dataIndex: 'stockSpec',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 7,
                    title: '生产厂家',
                    dataIndex: 'manfDesc',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 8,
                    title: '剂型',
                    dataIndex: 'formDesc',
                    align: "center",
                    width: '150px'
                }
            ]
            // 住院发药查询详细表头
            this.modalColumns = [
                {
                    key: 1,
                    title: '病区',
                    dataIndex: 'wardDesc',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 2,
                    title: '病人登记号',
                    dataIndex: 'patNO',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 3,
                    title: '病人姓名',
                    dataIndex: 'patName',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 4,
                    title: '床号',
                    dataIndex: 'bedNO',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 5,
                    title: '药品名称',
                    dataIndex: 'stockDesc',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 6,
                    title: '发药数量',
                    dataIndex: 'qty',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 7,
                    title: '单次剂量',
                    dataIndex: 'ordDoseQty',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 8,
                    title: '频次',
                    dataIndex: 'ordFreqDesc',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 9,
                    title: '用法',
                    dataIndex: 'ordUsageDesc',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 10,
                    title: '疗程',
                    dataIndex: 'ordDuratDesc',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 11,
                    title: '医嘱优先级',
                    dataIndex: 'ordPriorityDesc',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 12,
                    title: '处方号',
                    dataIndex: 'ordPrescNo',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 13,
                    title: '药品批次',
                    dataIndex: 'batNo',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 14,
                    title: '诊断',
                    dataIndex: 'diagnosis',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 15,
                    title: '开单医生',
                    dataIndex: 'ordDocName',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 16,
                    title: '医嘱日期',
                    dataIndex: 'ordDate',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 17,
                    title: '医嘱时间',
                    dataIndex: 'ordTime',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 18,
                    title: '要求执行日期',
                    dataIndex: 'reqDate',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 19,
                    title: '要求执行时间',
                    dataIndex: 'reqTime',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 20,
                    title: '售价',
                    dataIndex: 'sp',
                    align: "center",
                    width: '150px'
                },
                {
                    key: 21,
                    title: '售价金额',
                    dataIndex: 'spAmt',
                    align: "center",
                    width: '150px'
                }
            ]
        }

        componentDidMount() {
            // 初始化数据
            this.getTacitlyApproveData();
            this.getDetailTableColumns();
            this.getDetailListTableColumns();
            this.getCollectListTableColumns();
            let leftList = document.querySelectorAll('.tableListHeight  .ant-table-body');
            if(leftList.length>0){
                leftList[0].style.height = store.getState().tableHeight.y - 30 + 'px';
            }
            let listData = document.querySelectorAll('.tableDetailHeight  .ant-table-body');
            if(listData.length>0){
                listData[0].style.height = store.getState().tableHeight.y - 325 + 'px';
            }
            let collectData = document.querySelectorAll('.tableCollectHeight  .ant-table-body');
            if(collectData.length>0){
                collectData[0].style.height = store.getState().tableHeight.y - 325 + 'px';
            }
        }

        // 获取主列表头数据
        getDetailTableColumns = () => {
            let data = {
                params: [{
                    compontName: 'HPDrugInquiry',
                    type: 'C',
                }]
            }
            $http.post('urlS', this, {
                code: '01040073',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        let arr = res.result.C&&res.result.C.length > 0 ? JSON.parse(JSON.stringify(res.result.C)).map((item, index) => {
                            return  {
                                ...item,
                                key: index + 1,
                                title: <div onDoubleClick={() => {this.setState({parameterCode: 'HPDrugInquiry'},()=>{
                                    this.columnRef.onOpenModel();
                                }) }}>{item.title}</div>
                            }
                        }) : '';
                        let filterArr = arr.filter(function(item){ return item.display === 'Y'});
                        this.setState({columns: filterArr, detailWidthTotal: res.totalWidth})
                    }
                }
            })
        };

        // 获取明系列表头数据
        getDetailListTableColumns = () => {
            let data = {
                params: [{
                    compontName: 'HPDrugInquiryDetail',
                    type: 'C',
                }]
            }
            $http.post('urlS', this, {
                code: '01040073',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        let arr = res.result.C&&res.result.C.length > 0 ? JSON.parse(JSON.stringify(res.result.C)).map((item, index) => {
                            return  {
                                ...item,
                                key: index + 1,
                                title: <div onDoubleClick={() => {this.setState({parameterCode: 'HPDrugInquiryDetail'},()=>{
                                    this.columnRef.onOpenModel();
                                }) }}>{item.title}</div>
                            }
                        }) : '';
                        let filterArr = arr.filter(function(item){ return item.display === 'Y'});
                        this.setState({modalColumns: filterArr, listLength: res.totalWidth})
                    }
                }
            })
        };
        // 获取汇总列表头数据
        getCollectListTableColumns = () => {
            let data = {
                params: [{
                    compontName: 'HPDrugInquiryCollect',
                    type: 'C',
                }]
            }
            $http.post('urlS', this, {
                code: '01040073',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        let arr = res.result.C&&res.result.C.length > 0 ? JSON.parse(JSON.stringify(res.result.C)).map((item, index) => {
                            return  {
                                ...item,
                                key: index + 1,
                                title: <div onDoubleClick={() => {this.setState({parameterCode: 'HPDrugInquiryCollect'},()=>{
                                    this.columnRef.onOpenModel();
                                }) }}>{item.title}</div>
                            }
                        }) : '';
                        let filterArr = arr.filter(function(item){ return item.display === 'Y'});
                        this.setState({modalColumnsCollect: filterArr, listLengthCollect: res.totalWidth})
                    }
                }
            })
        };

        //清空表格内容
        handleReset = () => {
            this.setState({HPDrugInquiryData: [],HPDrugInquiryDetailData: [],total: 0, detailsId: '',HPDrugInquiryCollectData: [],detailTotal: '', collectTotal: ''});
            this.props.form.resetFields();
        };

        // 获取界面默认值
        getTacitlyApproveData() {
            let data = {
                params: []
            };
            // 获取下拉数据
            $http.post('urlS', this, {
                code: "02040043",
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({SelectData: res})
                    }
                }
            })
        }

        handleQuery=()=>{
            this.setState({page: 1},()=>{
                this.getHPDrugInquiryList()
            })
        };

        // 获取住院发药查询列表数据
        getHPDrugInquiryList=()=>{
            this.setState({detailsId: '', loading:true});
            this.props.form.validateFields((err , val)=> {
                let obj = JSON.parse(JSON.stringify(val));
                if (err == null) {
                    let data = {
                        params: [{
                            startDate: obj.StartDate ? Moment(obj.StartDate).format('YYYY-MM-DD') : undefined,
                            endDate: obj.EndDate ? Moment(obj.EndDate).format('YYYY-MM-DD') : undefined,
                            recLocID: obj.recLoc ? obj.recLoc : undefined,
                            priority: obj.priority ? obj.priority : undefined,
                            wardID: obj.ward ? obj.ward : undefined,
                            dispCatID: obj.dispCat ? obj.dispCat : undefined,
                            dispUserID: obj.dispUser ? obj.dispUser : undefined

                        }],
                        pagination: [
                            {
                                pageSize:this.state.pageSize,
                                currentPage:this.state.page,
                                sort:"ID",
                                dir:"asc",
                            }
                        ],
                    };
                    $http.post('urlS', this, {
                        code: "02040044",
                        data: data,
                        success: function (res) {
                            if(res.rows.length > 0){
                                for(let i = 0; i < res.rows.length; i++){
                                    res.rows[i].key = i;
                                }
                                this.setState({ HPDrugInquiryData: res.rows,total: res.total,HPDrugID: res.rows[0].inDispID , page2: 1, loading: false});
                                serialNumber = 0;
                                this.HPDrugInquiryDetailList(res.rows[0].inDispID);
                                this.HPDrugInquiryCollectList(res.rows[0].inDispID);

                            }else {
                                this.setState({HPDrugInquiryDetailData: [], HPDrugInquiryData: [], HPDrugInquiryCollectData: []});
                                if(!this.state.noData){
                                    message.error("没数据");
                                }else {
                                    this.setState({noData: false})
                                }
                            }
                        },
                        error: function (err) {
                            message.error(err.errorMessage)
                        }
                    });
                }
            });

        };
        // 获取住院发药查询明细
        HPDrugInquiryDetailList(id) {
            this.setState({detailsLoading:true})
            let data = {
                params: [{
                    inDispID: id,
                }],
                pagination: [
                    {
                        pageSize:this.state.pageSize2,
                        currentPage:id ? 1 : this.state.page2,
                        sort:"ID",
                        dir:"asc",
                    }
                ]
            };
            $http.post('urlS', this, {
                code: "02040046",
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        serialNumber = this.state.detailsId ? this.state.detailsId : 0;
                        for(let i = 0; i < res.rows.length; i++){
                            res.rows[i].key = i;
                        }
                        this.setState({HPDrugInquiryDetailData:res.rows, detailTotal: res.total , detailsLoading: false});
                    }
                }
            })
        }
        // 获取住院发药查询汇总
        HPDrugInquiryCollectList(id) {
            this.setState({CollectLoading:true})
            let data = {
                params: [{
                    inDispID: id,
                }],
                pagination: [
                    {
                        pageSize:this.state.pageSizeCollect,
                        currentPage:id ? 1 : this.state.pageCollect,
                        sort:"ID",
                        dir:"asc",
                    }
                ]
            };
            $http.post('urlS', this, {
                code: "02040045",
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        serialNumber = this.state.detailsId ? this.state.detailsId : 0;
                        for(let i = 0; i < res.rows.length; i++){
                            res.rows[i].key = i;
                        }
                        this.setState({HPDrugInquiryCollectData:res.rows, collectTotal: res.total , CollectLoading: false});
                    }
                }
            })
        }

        //点击行，渲染当前行样式
        setRowClassName = (record) => {
            serialNumber = serialNumber + 1;
            if(record){
                if(serialNumber == 1) return 'clickRowStyle';
                else if (this.state.detailsId == record.key) return 'clickRowStyle';
                else return '';
                // return this.state.detailsId == record.inOperID ? 'clickRowStyle ': '';
            }else {
                return '';
            }
        };

        // 页码改变的回调，参数是改变后的页码及每页条数 住院发药查询
        onChange = (page, pageSize) => {
            this.setState({page: page, pageSize: this.state.pageSize}, () => {
                // 重新调用查询方法
                this.handleQuery();
            });
        };

        onShowSizeChange = (current, size) => {
            this.setState({page: current, pageSize: size}, () => {
                // 重新调用查询方法
                this.onChange(current,size);
            })
        };

        // 页码改变的回调，参数是改变后的页码及每页条数 住院发药查询详情
        onChange2 = (page, pageSize) => {
            this.setState({page2: page, pageSize2: pageSize}, () => {
                // 重新调用查询方法
                this.HPDrugInquiryDetailList(this.state.HPDrugID);
            });
        };

        onShowSizeChange2 = (current, size) => {
            this.setState({page2: current, pageSize2: size}, () => {
                // 重新调用查询方法
                this.onChange2(current,size);
            })
        };
        // 页码改变的回调，参数是改变后的页码及每页条数 住院发药查询详情
        onChangeCollect = (page, pageSize) => {
            this.setState({pageCollect: page, pageSizeCollect: pageSize}, () => {
                // 重新调用查询方法
                this.HPDrugInquiryCollectList(this.state.HPDrugID);
            });
        };

        onShowSizeChangeCollect = (current, size) => {
            this.setState({pageCollect: current, pageSizeCollect: size}, () => {
                // 重新调用查询方法
                this.onChangeCollect(current,size);
            })
        };
        // 显示分页总条数
        showTotal(total) {
            return `共 ${total} 条`;
        }
        //组件权限编辑器
        onColumnRef = (ref) => {
            this.columnRef = ref;
        };

        // 收起明细录入
        packUpHandle = () => {
            this.setState({show: !this.state.show})
        }
        render() {
            const { getFieldDecorator } = this.props.form;
            const { modalColumns, columns, listLength, detailWidthTotal, listLengthCollect,  modalColumnsCollect} = this.state;
            let userInfo = this.state.userInfo ? this.state.userInfo: {};
            //入库科室列表
            let inOpLocDrSelect = [];
            this.state.SelectData.loc && this.state.SelectData.loc.map((item, i) => {
                inOpLocDrSelect.push(<Option value={item.id} key={i}>{item.descripts}</Option>)
            });

            return (
                <div className="HPDrugInquiry">
                    <Row>
                        <Card
                            size="small"
                            title={<div className="card-title-left-icon"><div></div>查询条件</div>}
                        >
                            <Col span={21}>
                                <Form>
                                    <Row >
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label="发药科室">
                                                {getFieldDecorator('recLoc',{
                                                    initialValue: this.state.userInfo.locID ? this.state.userInfo.locID : undefined,
                                                    rules:[{ required : true, message: '发药科室不能为空'}]
                                                })(
                                                    <Select allowClear>
                                                        {inOpLocDrSelect}
                                                    </Select>
                                                ) }
                                            </FormItem>
                                        </Col>
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label="发药人">
                                                {getFieldDecorator('dispUser',{
                                                    initialValue: undefined,
                                                    rules:[{required: false,message: '发药人不能为空'}]
                                                })(
                                                    <Select allowClear>
                                                        {this.state.SelectData.locUser && this.state.SelectData.locUser.map((item, i) => {
                                                            return <Option value={item.id} key={i}>{item.descripts}</Option>
                                                        })}
                                                    </Select>
                                                ) }
                                            </FormItem>
                                        </Col>
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label="发药类别">
                                                {getFieldDecorator('dispCat',{
                                                    initialValue: undefined,
                                                    rules:[{required: false,message: '发药类别不能为空'}]
                                                })(
                                                    <Select allowClear>
                                                        {this.state.SelectData.dispCat && this.state.SelectData.dispCat.map((item, i) => {
                                                            return <Option value={item.id} key={i}>{item.descripts}</Option>
                                                        })}
                                                    </Select>
                                                ) }
                                            </FormItem>
                                        </Col>
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label="医嘱优先级">
                                                {getFieldDecorator('priority',{
                                                    initialValue: undefined,
                                                    rules:[{required: false,message: '医嘱优先级不能为空'}]
                                                })(
                                                    <Select allowClear>

                                                    </Select>
                                                ) }
                                            </FormItem>
                                        </Col>
                                    </Row>
                                    <Row>
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label="病区">
                                                {getFieldDecorator('ward',{
                                                    initialValue: undefined,
                                                    rules:[{required: false,message: '病区不能为空'}]
                                                })(
                                                    <Select allowClear>
                                                        {this.state.SelectData.ward && this.state.SelectData.ward.map((item, i) => {
                                                            return <Option value={item.id} key={i}>{item.descripts}</Option>
                                                        })}
                                                    </Select>
                                                ) }
                                            </FormItem>
                                        </Col>
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label="起初日期">
                                                {getFieldDecorator('StartDate',{
                                                    initialValue: Moment(Moment().format('L'), 'YYYY-MM-DD'),
                                                    rules:[{required: false}]
                                                })(
                                                    <DatePicker style={{width: '100%'}} />
                                                ) }
                                            </FormItem>
                                        </Col>
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label="截至日期">
                                                {getFieldDecorator('EndDate',{
                                                    initialValue: Moment(Moment().format('L'), 'YYYY-MM-DD'),
                                                    rules:[{required: false}]
                                                })(
                                                    <DatePicker style={{width: '100%'}} />
                                                ) }
                                            </FormItem>
                                        </Col>

                                    </Row>
                                </Form>
                            </Col>
                            <Col span={3} style={{textAlign: 'center'}}>
                                <Row style={{marginBottom: '18px'}}><Button onClick={this.handleQuery}>查询</Button></Row>
                                <Row><Button type="primary" onClick={this.handleReset}>清屏</Button></Row>
                            </Col>

                        </Card>
                    </Row>
                    <Col span={9} style={{display: this.state.show ? 'none' : ''}} className={!this.state.show ? "animate-wrap active down-in" : "animate-wrap"}>
                        <Row>
                            <Col>
                                <Card
                                    size="small"
                                    title={<div className="card-title-left-icon"><div></div>发药查询列表</div>}
                                    extra={<span style={{color: '#666'}} className='span' onClick={() => {this.setState({parameterCode: 'HPDrugInquiry'},()=>{
                                        this.columnRef.onOpenModel();
                                    })}}><Icon type="setting" title="列权限设置" /></span>}
                                >
                                    <div>
                                        <Table
                                            columns={ columns.length>0 ? columns : this.columns}
                                            dataSource={this.state.HPDrugInquiryData}
                                            pagination={false}
                                            bordered
                                            scroll={{x: detailWidthTotal ? detailWidthTotal: 1200,y:  store.getState().tableHeight.y - 66 }}
                                            style={{height: store.getState().tableHeight.y - 24}}
                                            rowKey={record => record.key}
                                            rowClassName={this.setRowClassName}
                                            className="tableListHeight"
                                            onRow={(record) => {
                                                return {
                                                    onClick: () => {
                                                        serialNumber = 9999;
                                                        this.setState({detailsId: record.key,HPDrugID: record.inDispID,page2: 1, pageCollect: 1},()=>{
                                                            this.HPDrugInquiryDetailList(record.inDispID)
                                                            this.HPDrugInquiryCollectList(record.inDispID)
                                                        });

                                                    },

                                                };
                                            }}
                                        />
                                        <CommonPagination size='small' current={this.state.page} total={this.state.total} search= 'search'
                                                          onShowSizeChange={this.onShowSizeChange.bind(this)} complete={true} dataSource={this.state.HPDrugInquiryData}
                                                          loading={this.state.loading} onChange={this.onChange.bind(this)} />
                                    </div>
                                </Card>
                            </Col>
                        </Row>
                    </Col>
                    <Col span={15} span={this.state.show ? 24 : 15}>
                        <Row>
                            <Col>
                                <Card
                                    size="small"
                                    title={<span><Icon onClick={this.packUpHandle} type={this.state.show ? 'double-right' : 'double-left'} />汇总</span>}
                                    extra={<span style={{color: '#666'}} className='span' onClick={() => {this.setState({parameterCode: 'HPDrugInquiryCollect'},()=>{
                                        this.columnRef.onOpenModel();
                                    })}}><Icon type="setting" title="列权限设置" /></span>}
                                >
                                    <div>
                                        <Table
                                            columns={modalColumnsCollect.length>0 ? modalColumnsCollect : this.collectModalColumns}
                                            dataSource={this.state.HPDrugInquiryCollectData}
                                            pagination={false}
                                            bordered
                                            scroll={{x:listLengthCollect ? listLengthCollect : 1200, y: store.getState().tableHeight.y - 400 }}
                                            style={{height: (store.getState().tableHeight.y - 360)}}
                                            rowKey={record => record.key}
                                            className="tableCollectHeight"
                                        />
                                        <CommonPagination size='small' current={this.state.pageCollect} total={this.state.collectTotal} search= 'search'
                                                          onShowSizeChange={this.onShowSizeChangeCollect.bind(this)} complete={true} dataSource={this.state.HPDrugInquiryCollectData}
                                                          loading={this.state.CollectLoading} onChange={this.onChangeCollect.bind(this)} />
                                    </div>
                                </Card>
                            </Col>
                        </Row>
                        <Row>
                            <Col>
                                <Card
                                    size="small"
                                    title={<div className="card-title-left-icon"><div></div>明细</div>}
                                    extra={<span style={{color: '#666'}} className='span' onClick={() => {this.setState({parameterCode: 'HPDrugInquiryDetail'},()=>{
                                        this.columnRef.onOpenModel();
                                    })}}><Icon type="setting" title="列权限设置" /></span>}
                                >
                                    <div>
                                        <Table
                                            columns={modalColumns.length>0 ? modalColumns : this.modalColumns}
                                            dataSource={this.state.HPDrugInquiryDetailData}
                                            pagination={false}
                                            bordered
                                            scroll={{x:listLength ? listLength : 3150, y: store.getState().tableHeight.y - 433}}
                                            style={{height: (store.getState().tableHeight.y - 390)}}
                                            rowKey={record => record.key}
                                            className="tableDetailHeight"
                                        />
                                        <CommonPagination size='small' current={this.state.page2} total={this.state.detailTotal} search= 'search'
                                                          onShowSizeChange={this.onShowSizeChange2.bind(this)} complete={true} dataSource={this.state.HPDrugInquiryDetailData}
                                                          loading={this.state.detailsLoading} onChange={this.onChange2.bind(this)} />
                                    </div>
                                </Card>
                            </Col>
                        </Row>
                    </Col>


                    <ColumnAuthoritysModel
                        clientWidth='800px'
                        compontName={ this.state.parameterCode}
                        configType="C"
                        onRef={this.onColumnRef}
                        reloadData={() => {
                            if (this.state.parameterCode == 'HPDrugInquiry') {
                                this.getDetailTableColumns()
                            }else if(this.state.parameterCode == 'HPDrugInquiryDetail'){
                                this.getDetailListTableColumns()
                            }else if(this.state.parameterCode == 'HPDrugInquiryCollect'){
                                this.getCollectListTableColumns()
                            }
                        }
                        }
                    />
                </div>
            )
        }
    }
);
export default HPDrugInquiry;